ProbCompInK <- function(K,N) {
  
  pinK <- integer(K)
  pinK[1] = 1/N
  if (K >1) {
    for (k in 2:K) {
      pink = k/N
      pinK[k] = pink + (1-pink)*pinK[k-1]
    }
  }
  PinK = sum(pinK)
  return(PinK)
}